package awesome.android.apps.flashlight_red;

import net.daum.mobilead.AdConfig;
import net.daum.mobilead.AdHttpListener;
import net.daum.mobilead.MobileAdView;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;

public class FlashlightActivity extends Activity implements AdHttpListener {
	private MobileAdView adView = null;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
        
        initAdam();
    }
    
    @Override
    protected void onDestroy() {
    	getWindow().clearFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    	
    	super.onDestroy();
    }

    /**
     * AD@m
     */
	private void initAdam() {

		// 할당 받은 clientId 설정
		AdConfig.setClientId("177bZ2pT133f51dd116");

		// Ad@m sdk 초기화 시작
		adView = (MobileAdView) findViewById(R.id.adview);
		// adView.setRequestInterval(60);
		adView.setAdListener(this);
		adView.setVisibility(View.VISIBLE);
	}
	
	@Override
	public void failedDownloadAd_AdListener(int errorno, String errMsg) {
		// fail to receive Ad
		
	}
	
	@Override
	public void didDownloadAd_AdListener() {
	   // success to receive Ad
		
	}
}